<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Bundler::Thor::Shell::Basic - bundler: Ruby Standard Library Documentation</title>


<script src="../../../js/navigation.js" defer></script>
<script src="../../../js/search.js" defer></script>
<script src="../../../js/search_index.js" defer></script>
<script src="../../../js/searcher.js" defer></script>
<script src="../../../js/darkfish.js" defer></script>

<script src="../../../js/jquery-3.2.0.min.js"></script>

<script src="../../../js/vue.min.js"></script>
<script src="../../../js/js.cookie.min.js"></script>

<link href="../../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../../css/rdoc.css" rel="stylesheet">
<link href="../../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../../";
  var index_rel_prefix = "../../../";
  var darkModeCsseHref = "../../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../../table_of_contents.html#pages">Pages</a>
    <a href="../../../table_of_contents.html#classes">Classes</a>
    <a href="../../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../../../Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-i-answer_match">#answer_match</a>
    <li ><a href="#method-i-as_unicode">#as_unicode</a>
    <li ><a href="#method-i-ask">#ask</a>
    <li ><a href="#method-i-ask_filtered">#ask_filtered</a>
    <li ><a href="#method-i-ask_simply">#ask_simply</a>
    <li ><a href="#method-i-can_display_colors-3F">#can_display_colors?</a>
    <li ><a href="#method-i-dynamic_width">#dynamic_width</a>
    <li ><a href="#method-i-dynamic_width_stty">#dynamic_width_stty</a>
    <li ><a href="#method-i-dynamic_width_tput">#dynamic_width_tput</a>
    <li ><a href="#method-i-error">#error</a>
    <li ><a href="#method-i-file_collision">#file_collision</a>
    <li ><a href="#method-i-indent">#indent</a>
    <li ><a href="#method-i-lookup_color">#lookup_color</a>
    <li ><a href="#method-i-mute">#mute</a>
    <li ><a href="#method-i-mute-3F">#mute?</a>
    <li ><a href="#method-i-no-3F">#no?</a>
    <li ><a href="#method-i-padding-3D">#padding=</a>
    <li ><a href="#method-i-prepare_message">#prepare_message</a>
    <li ><a href="#method-i-print_in_columns">#print_in_columns</a>
    <li ><a href="#method-i-print_table">#print_table</a>
    <li ><a href="#method-i-print_wrapped">#print_wrapped</a>
    <li ><a href="#method-i-say">#say</a>
    <li ><a href="#method-i-say_error">#say_error</a>
    <li ><a href="#method-i-say_status">#say_status</a>
    <li ><a href="#method-i-stderr">#stderr</a>
    <li ><a href="#method-i-stdout">#stdout</a>
    <li ><a href="#method-i-terminal_width">#terminal_width</a>
    <li ><a href="#method-i-truncate">#truncate</a>
    <li ><a href="#method-i-unix-3F">#unix?</a>
    <li ><a href="#method-i-yes-3F">#yes?</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Bundler::Thor::Shell::Basic">
    <h1 id="class-Bundler::Thor::Shell::Basic" class="class">
      class Bundler::Thor::Shell::Basic
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="DEFAULT_TERMINAL_WIDTH">DEFAULT_TERMINAL_WIDTH
          <dd>
        </dl>
        </section>

        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-base" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">base</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-padding" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">padding</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
            </section>


                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-ask" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ask</span><span
                                class="method-args">(statement, *args)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Asks something to the user and receives a response.</p>

<p>If a default value is specified it will be presented to the user and allows them to select that value with an empty response. This option is ignored when limited answers are supplied.</p>

<p>If asked to limit the correct responses, you can pass in an array of acceptable answers.  If one of those is not supplied, they will be shown a message stating that one of those answers must be given and re-asked the question.</p>

<p>If asking for sensitive information, the :echo option can be set to false to mask user input from $stdin.</p>

<p>If the required input is a path, then set the path option to true. This will enable tab completion for file paths relative to the current working directory on systems that support Readline.</p>

<h4 id="method-i-ask-label-Example">Example<span><a href="#method-i-ask-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h4>

<p>ask(“What is your name?”)</p>

<p>ask(“What is the planet furthest from the sun?”, :default =&gt; “Pluto”)</p>

<p>ask(“What is your favorite Neopolitan flavor?”, :limited_to =&gt; [“strawberry”, “chocolate”, “vanilla”])</p>

<p>ask(“What is your password?”, :echo =&gt; false)</p>

<p>ask(“Where should the file be saved?”, :path =&gt; true)</p>

                              <div class="method-source-code" id="ask-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 78</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ask</span>(<span class="ruby-identifier">statement</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">pop</span> <span class="ruby-operator">:</span> {}
  <span class="ruby-identifier">color</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:limited_to</span>]
    <span class="ruby-identifier">ask_filtered</span>(<span class="ruby-identifier">statement</span>, <span class="ruby-identifier">color</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">ask_simply</span>(<span class="ruby-identifier">statement</span>, <span class="ruby-identifier">color</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-error" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">error</span><span
                                class="method-args">(statement)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Called if something goes wrong during the execution. This is used by Bundler::Thor internally and should not be used inside your scripts. If something went wrong, you can always raise an exception. If you raise a <a href="../../../Error.html"><code>Bundler::Thor::Error</code></a>, it will be rescued and wrapped in the method below.</p>

                              <div class="method-source-code" id="error-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 342</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">error</span>(<span class="ruby-identifier">statement</span>)
  <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">statement</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-file_collision" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">file_collision</span><span
                                class="method-args">(destination) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Deals with file collision and returns true if the file should be overwritten and false otherwise. If a block is given, it uses the block response as the content for the diff.</p>

<h4 id="method-i-file_collision-label-Parameters">Parameters<span><a href="#method-i-file_collision-label-Parameters">&para;</a> <a href="#top">&uarr;</a></span></h4>
<dl class="rdoc-list note-list"><dt>destination&lt;String&gt;
<dd>
<p>the destination file to solve conflicts</p>
</dd><dt>block&lt;Proc&gt;
<dd>
<p>an optional block that returns the value to be used in diff and merge</p>
</dd></dl>

                              <div class="method-source-code" id="file_collision-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 285</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">file_collision</span>(<span class="ruby-identifier">destination</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@always_force</span>
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">block_given?</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;[Ynaqdhm]&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;[Ynaqh]&quot;</span>

  <span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">answer</span> = <span class="ruby-identifier">ask</span>(
      <span class="ruby-node">%[Overwrite #{destination}? (enter &quot;h&quot; for help) #{options}]</span>,
      <span class="ruby-value">:add_to_history</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">false</span>
    )

    <span class="ruby-keyword">case</span> <span class="ruby-identifier">answer</span>
    <span class="ruby-keyword">when</span> <span class="ruby-keyword">nil</span>
      <span class="ruby-identifier">say</span> <span class="ruby-string">&quot;&quot;</span>
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">when</span> <span class="ruby-identifier">is?</span>(<span class="ruby-value">:yes</span>), <span class="ruby-identifier">is?</span>(<span class="ruby-value">:force</span>), <span class="ruby-string">&quot;&quot;</span>
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">when</span> <span class="ruby-identifier">is?</span>(<span class="ruby-value">:no</span>), <span class="ruby-identifier">is?</span>(<span class="ruby-value">:skip</span>)
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">when</span> <span class="ruby-identifier">is?</span>(<span class="ruby-value">:always</span>)
      <span class="ruby-keyword">return</span> <span class="ruby-ivar">@always_force</span> = <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">when</span> <span class="ruby-identifier">is?</span>(<span class="ruby-value">:quit</span>)
      <span class="ruby-identifier">say</span> <span class="ruby-string">&quot;Aborting...&quot;</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">SystemExit</span>
    <span class="ruby-keyword">when</span> <span class="ruby-identifier">is?</span>(<span class="ruby-value">:diff</span>)
      <span class="ruby-identifier">show_diff</span>(<span class="ruby-identifier">destination</span>, <span class="ruby-keyword">yield</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
      <span class="ruby-identifier">say</span> <span class="ruby-string">&quot;Retrying...&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-identifier">is?</span>(<span class="ruby-value">:merge</span>)
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">merge_tool</span>.<span class="ruby-identifier">empty?</span>
        <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">destination</span>, <span class="ruby-keyword">yield</span>)
        <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
      <span class="ruby-keyword">end</span>

      <span class="ruby-identifier">say</span> <span class="ruby-string">&quot;Please specify merge tool to `THOR_MERGE` env.&quot;</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">say</span> <span class="ruby-identifier">file_collision_help</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-indent" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">indent</span><span
                                class="method-args">(count = 1) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Sets the output padding while executing a block and resets it.</p>

                              <div class="method-source-code" id="indent-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 41</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">indent</span>(<span class="ruby-identifier">count</span> = <span class="ruby-value">1</span>)
  <span class="ruby-identifier">orig_padding</span> = <span class="ruby-identifier">padding</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">padding</span> = <span class="ruby-identifier">padding</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">count</span>
  <span class="ruby-keyword">yield</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">padding</span> = <span class="ruby-identifier">orig_padding</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-mute" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">mute</span><span
                                class="method-args">() { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Mute everything that’s inside given block</p>

                              <div class="method-source-code" id="mute-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 20</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mute</span>
  <span class="ruby-ivar">@mute</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">yield</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-ivar">@mute</span> = <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-mute-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">mute?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Check if base is muted</p>

                              <div class="method-source-code" id="mute-3F-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 29</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mute?</span>
  <span class="ruby-ivar">@mute</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-no-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">no?</span><span
                                class="method-args">(statement, color = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Make a question the to user and returns true if the user replies “n” or “no”.</p>

                              <div class="method-source-code" id="no-3F-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 154</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">no?</span>(<span class="ruby-identifier">statement</span>, <span class="ruby-identifier">color</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-operator">!</span><span class="ruby-operator">!</span>(<span class="ruby-identifier">ask</span>(<span class="ruby-identifier">statement</span>, <span class="ruby-identifier">color</span>, <span class="ruby-value">:add_to_history</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">false</span>) <span class="ruby-operator">=~</span> <span class="ruby-identifier">is?</span>(<span class="ruby-value">:no</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-padding-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">padding=</span><span
                                class="method-args">(value)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Sets the output padding, not allowing less than zero values.</p>

                              <div class="method-source-code" id="padding-3D-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 35</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">padding=</span>(<span class="ruby-identifier">value</span>)
  <span class="ruby-ivar">@padding</span> = [<span class="ruby-value">0</span>, <span class="ruby-identifier">value</span>].<span class="ruby-identifier">max</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-print_in_columns" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">print_in_columns</span><span
                                class="method-args">(array)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Prints values in columns</p>

<h4 id="method-i-print_in_columns-label-Parameters">Parameters<span><a href="#method-i-print_in_columns-label-Parameters">&para;</a> <a href="#top">&uarr;</a></span></h4>

<p>Array[String, String, …]</p>

                              <div class="method-source-code" id="print_in_columns-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 163</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">print_in_columns</span>(<span class="ruby-identifier">array</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">array</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">colwidth</span> = (<span class="ruby-identifier">array</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">el</span><span class="ruby-operator">|</span> <span class="ruby-identifier">el</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">size</span> }.<span class="ruby-identifier">max</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">+</span> <span class="ruby-value">2</span>
  <span class="ruby-identifier">array</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
    <span class="ruby-comment"># Don&#39;t output trailing spaces when printing the last column</span>
    <span class="ruby-keyword">if</span> ((((<span class="ruby-identifier">index</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>) <span class="ruby-operator">%</span> (<span class="ruby-identifier">terminal_width</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">colwidth</span>))).<span class="ruby-identifier">zero?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">index</span>.<span class="ruby-identifier">zero?</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">array</span>.<span class="ruby-identifier">length</span>
      <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">value</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">printf</span>(<span class="ruby-node">&quot;%-#{colwidth}s&quot;</span>, <span class="ruby-identifier">value</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-print_table" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">print_table</span><span
                                class="method-args">(array, options = {})</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Prints a table.</p>

<h4 id="method-i-print_table-label-Parameters">Parameters<span><a href="#method-i-print_table-label-Parameters">&para;</a> <a href="#top">&uarr;</a></span></h4>

<p>Array[Array[String, String, …]]</p>

<h4 id="method-i-print_table-label-Options">Options<span><a href="#method-i-print_table-label-Options">&para;</a> <a href="#top">&uarr;</a></span></h4>
<dl class="rdoc-list note-list"><dt>indent&lt;Integer&gt;
<dd>
<p>Indent the first column by indent value.</p>
</dd><dt>colwidth&lt;Integer&gt;
<dd>
<p>Force the first column to colwidth spaces wide.</p>
</dd></dl>

                              <div class="method-source-code" id="print_table-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 185</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">print_table</span>(<span class="ruby-identifier">array</span>, <span class="ruby-identifier">options</span> = {}) <span class="ruby-comment"># rubocop:disable Metrics/MethodLength</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">array</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">formats</span> = []
  <span class="ruby-identifier">indent</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:indent</span>].<span class="ruby-identifier">to_i</span>
  <span class="ruby-identifier">colwidth</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:colwidth</span>]
  <span class="ruby-identifier">options</span>[<span class="ruby-value">:truncate</span>] = <span class="ruby-identifier">terminal_width</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:truncate</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">true</span>

  <span class="ruby-identifier">formats</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;%-#{colwidth + 2}s&quot;</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">colwidth</span>
  <span class="ruby-identifier">start</span> = <span class="ruby-identifier">colwidth</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>

  <span class="ruby-identifier">colcount</span> = <span class="ruby-identifier">array</span>.<span class="ruby-identifier">max</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">size</span> }.<span class="ruby-identifier">size</span>

  <span class="ruby-identifier">maximas</span> = []

  <span class="ruby-identifier">start</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">colcount</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">maxima</span> = <span class="ruby-identifier">array</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">row</span><span class="ruby-operator">|</span> <span class="ruby-identifier">row</span>[<span class="ruby-identifier">index</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">row</span>[<span class="ruby-identifier">index</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span> }.<span class="ruby-identifier">max</span>
    <span class="ruby-identifier">maximas</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">maxima</span>
    <span class="ruby-identifier">formats</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">colcount</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
                 <span class="ruby-comment"># Don&#39;t output 2 trailing spaces when printing the last column</span>
                 <span class="ruby-string">&quot;%-s&quot;</span>.<span class="ruby-identifier">dup</span>
               <span class="ruby-keyword">else</span>
                 <span class="ruby-node">&quot;%-#{maxima + 2}s&quot;</span>.<span class="ruby-identifier">dup</span>
               <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">formats</span>[<span class="ruby-value">0</span>] = <span class="ruby-identifier">formats</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>, <span class="ruby-string">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">indent</span>)
  <span class="ruby-identifier">formats</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;%s&quot;</span>

  <span class="ruby-identifier">array</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">row</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">sentence</span> = <span class="ruby-string">&quot;&quot;</span>.<span class="ruby-identifier">dup</span>

    <span class="ruby-identifier">row</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">column</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">maxima</span> = <span class="ruby-identifier">maximas</span>[<span class="ruby-identifier">index</span>]

      <span class="ruby-identifier">f</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Numeric</span>)
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">row</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
          <span class="ruby-comment"># Don&#39;t output 2 trailing spaces when printing the last column</span>
          <span class="ruby-node">&quot;%#{maxima}s&quot;</span>
        <span class="ruby-keyword">else</span>
          <span class="ruby-node">&quot;%#{maxima}s  &quot;</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">formats</span>[<span class="ruby-identifier">index</span>]
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">sentence</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">f</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_s</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">sentence</span> = <span class="ruby-identifier">truncate</span>(<span class="ruby-identifier">sentence</span>, <span class="ruby-identifier">options</span>[<span class="ruby-value">:truncate</span>]) <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:truncate</span>]
    <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">sentence</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-print_wrapped" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">print_wrapped</span><span
                                class="method-args">(message, options = {})</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Prints a long string, word-wrapping the text to the current width of the terminal display. Ideal for printing heredocs.</p>

<h4 id="method-i-print_wrapped-label-Parameters">Parameters<span><a href="#method-i-print_wrapped-label-Parameters">&para;</a> <a href="#top">&uarr;</a></span></h4>

<p>String</p>

<h4 id="method-i-print_wrapped-label-Options">Options<span><a href="#method-i-print_wrapped-label-Options">&para;</a> <a href="#top">&uarr;</a></span></h4>
<dl class="rdoc-list note-list"><dt>indent&lt;Integer&gt;
<dd>
<p>Indent each line of the printed paragraph by indent value.</p>
</dd></dl>

                              <div class="method-source-code" id="print_wrapped-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 247</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">print_wrapped</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">indent</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:indent</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">width</span> = <span class="ruby-identifier">terminal_width</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">indent</span>
  <span class="ruby-identifier">paras</span> = <span class="ruby-identifier">message</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;\n\n&quot;</span>)

  <span class="ruby-identifier">paras</span>.<span class="ruby-identifier">map!</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">unwrapped</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">words</span> = <span class="ruby-identifier">unwrapped</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot; &quot;</span>)
    <span class="ruby-identifier">counter</span> = <span class="ruby-identifier">words</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">length</span>
    <span class="ruby-identifier">words</span>.<span class="ruby-identifier">inject</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, <span class="ruby-identifier">word</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">word</span> = <span class="ruby-identifier">word</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\n\005/</span>, <span class="ruby-string">&quot;\n&quot;</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\005/</span>, <span class="ruby-string">&quot;\n&quot;</span>)
      <span class="ruby-identifier">counter</span> = <span class="ruby-value">0</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">word</span>.<span class="ruby-identifier">include?</span> <span class="ruby-string">&quot;\n&quot;</span>
      <span class="ruby-keyword">if</span> (<span class="ruby-identifier">counter</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">word</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>) <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">width</span>
        <span class="ruby-identifier">memo</span> = <span class="ruby-node">&quot;#{memo} #{word}&quot;</span>
        <span class="ruby-identifier">counter</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">word</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">memo</span> = <span class="ruby-node">&quot;#{memo}\n#{word}&quot;</span>
        <span class="ruby-identifier">counter</span> = <span class="ruby-identifier">word</span>.<span class="ruby-identifier">length</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">memo</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>.<span class="ruby-identifier">compact!</span>

  <span class="ruby-identifier">paras</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">para</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">para</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;\n&quot;</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>, <span class="ruby-string">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">indent</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">puts</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">para</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">paras</span>.<span class="ruby-identifier">last</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-say" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">say</span><span
                                class="method-args">(message = &quot;&quot;, color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Say (print) something to the user. If the sentence ends with a whitespace or tab character, a new line is not appended (print + flush). Otherwise are passed straight to puts (behavior got from Highline).</p>

<h4 id="method-i-say-label-Example">Example<span><a href="#method-i-say-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h4>

<p>say(“I know you knew that.”)</p>

                              <div class="method-source-code" id="say-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 96</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">say</span>(<span class="ruby-identifier">message</span> = <span class="ruby-string">&quot;&quot;</span>, <span class="ruby-identifier">color</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">force_new_line</span> = (<span class="ruby-identifier">message</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp">/( |\t)\Z/</span>))
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">quiet?</span>

  <span class="ruby-identifier">buffer</span> = <span class="ruby-identifier">prepare_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">color</span>)
  <span class="ruby-identifier">buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;\n&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">force_new_line</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">message</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">end_with?</span>(<span class="ruby-string">&quot;\n&quot;</span>)

  <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">buffer</span>)
  <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">flush</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-say_error" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">say_error</span><span
                                class="method-args">(message = &quot;&quot;, color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Say (print) an error to the user. If the sentence ends with a whitespace or tab character, a new line is not appended (print + flush). Otherwise are passed straight to puts (behavior got from Highline).</p>

<h4 id="method-i-say_error-label-Example">Example<span><a href="#method-i-say_error-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h4>

<p><a href="Basic.html#method-i-say_error"><code>say_error</code></a>(“error: something went wrong”)</p>

                              <div class="method-source-code" id="say_error-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 113</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">say_error</span>(<span class="ruby-identifier">message</span> = <span class="ruby-string">&quot;&quot;</span>, <span class="ruby-identifier">color</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">force_new_line</span> = (<span class="ruby-identifier">message</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp">/( |\t)\Z/</span>))
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">quiet?</span>

  <span class="ruby-identifier">buffer</span> = <span class="ruby-identifier">prepare_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">color</span>)
  <span class="ruby-identifier">buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;\n&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">force_new_line</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">message</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">end_with?</span>(<span class="ruby-string">&quot;\n&quot;</span>)

  <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">buffer</span>)
  <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">flush</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-say_status" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">say_status</span><span
                                class="method-args">(status, message, log_status = true)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Say a status with the given color and appends the message. Since this method is used frequently by actions, it allows nil or false to be given in log_status, avoiding the message from being shown. If a Symbol is given in log_status, it’s used as the color.</p>

                              <div class="method-source-code" id="say_status-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 128</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">say_status</span>(<span class="ruby-identifier">status</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">log_status</span> = <span class="ruby-keyword">true</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">quiet?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">log_status</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">false</span>
  <span class="ruby-identifier">spaces</span> = <span class="ruby-string">&quot;  &quot;</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">padding</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)
  <span class="ruby-identifier">status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">rjust</span>(<span class="ruby-value">12</span>)
  <span class="ruby-identifier">margin</span> = <span class="ruby-string">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">status</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spaces</span>

  <span class="ruby-identifier">color</span>  = <span class="ruby-identifier">log_status</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">log_status</span> <span class="ruby-operator">:</span> <span class="ruby-value">:green</span>
  <span class="ruby-identifier">status</span> = <span class="ruby-identifier">set_color</span> <span class="ruby-identifier">status</span>, <span class="ruby-identifier">color</span>, <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">color</span>

  <span class="ruby-identifier">message</span> = <span class="ruby-identifier">message</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/(?&lt;!\A)^/</span>, <span class="ruby-identifier">margin</span>)
  <span class="ruby-identifier">buffer</span> = <span class="ruby-node">&quot;#{status}#{spaces}#{message}\n&quot;</span>

  <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">buffer</span>)
  <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">flush</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-terminal_width" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">terminal_width</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>This code was copied from Rake, available under MIT-LICENSE Copyright © 2003, 2004 Jim Weirich</p>

                              <div class="method-source-code" id="terminal_width-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 326</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">terminal_width</span>
  <span class="ruby-identifier">result</span> = <span class="ruby-keyword">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;THOR_COLUMNS&quot;</span>]
    <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;THOR_COLUMNS&quot;</span>].<span class="ruby-identifier">to_i</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">unix?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">dynamic_width</span> <span class="ruby-operator">:</span> <span class="ruby-constant">DEFAULT_TERMINAL_WIDTH</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">10</span> <span class="ruby-operator">?</span> <span class="ruby-constant">DEFAULT_TERMINAL_WIDTH</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">result</span>
<span class="ruby-keyword">rescue</span>
  <span class="ruby-constant">DEFAULT_TERMINAL_WIDTH</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-yes-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">yes?</span><span
                                class="method-args">(statement, color = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Make a question the to user and returns true if the user replies “y” or “yes”.</p>

                              <div class="method-source-code" id="yes-3F-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 147</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">yes?</span>(<span class="ruby-identifier">statement</span>, <span class="ruby-identifier">color</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-operator">!</span><span class="ruby-operator">!</span>(<span class="ruby-identifier">ask</span>(<span class="ruby-identifier">statement</span>, <span class="ruby-identifier">color</span>, <span class="ruby-value">:add_to_history</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">false</span>) <span class="ruby-operator">=~</span> <span class="ruby-identifier">is?</span>(<span class="ruby-value">:yes</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="protected-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Protected Instance Methods</h3>
                </header>

                  <div id="method-i-answer_match" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">answer_match</span><span
                                class="method-args">(possibilities, answer, case_insensitive)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="answer_match-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 486</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">answer_match</span>(<span class="ruby-identifier">possibilities</span>, <span class="ruby-identifier">answer</span>, <span class="ruby-identifier">case_insensitive</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">case_insensitive</span>
    <span class="ruby-identifier">possibilities</span>.<span class="ruby-identifier">detect</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">possibility</span><span class="ruby-operator">|</span> <span class="ruby-identifier">possibility</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">answer</span>.<span class="ruby-identifier">downcase</span> }
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">possibilities</span>.<span class="ruby-identifier">detect</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">possibility</span><span class="ruby-operator">|</span> <span class="ruby-identifier">possibility</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">answer</span> }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-as_unicode" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">as_unicode</span><span
                                class="method-args">() { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="as_unicode-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 443</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">as_unicode</span>
  <span class="ruby-keyword">yield</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ask_filtered" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ask_filtered</span><span
                                class="method-args">(statement, color, options)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ask_filtered-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 473</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ask_filtered</span>(<span class="ruby-identifier">statement</span>, <span class="ruby-identifier">color</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">answer_set</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:limited_to</span>]
  <span class="ruby-identifier">case_insensitive</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:case_insensitive</span>, <span class="ruby-keyword">false</span>)
  <span class="ruby-identifier">correct_answer</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">until</span> <span class="ruby-identifier">correct_answer</span>
    <span class="ruby-identifier">answers</span> = <span class="ruby-identifier">answer_set</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;, &quot;</span>)
    <span class="ruby-identifier">answer</span> = <span class="ruby-identifier">ask_simply</span>(<span class="ruby-node">&quot;#{statement} [#{answers}]&quot;</span>, <span class="ruby-identifier">color</span>, <span class="ruby-identifier">options</span>)
    <span class="ruby-identifier">correct_answer</span> = <span class="ruby-identifier">answer_match</span>(<span class="ruby-identifier">answer_set</span>, <span class="ruby-identifier">answer</span>, <span class="ruby-identifier">case_insensitive</span>)
    <span class="ruby-identifier">say</span>(<span class="ruby-node">&quot;Your response must be one of: [#{answers}]. Please try again.&quot;</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">correct_answer</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">correct_answer</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ask_simply" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ask_simply</span><span
                                class="method-args">(statement, color, options)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ask_simply-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 456</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ask_simply</span>(<span class="ruby-identifier">statement</span>, <span class="ruby-identifier">color</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">default</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:default</span>]
  <span class="ruby-identifier">message</span> = [<span class="ruby-identifier">statement</span>, (<span class="ruby-node">&quot;(#{default})&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">default</span>), <span class="ruby-keyword">nil</span>].<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot; &quot;</span>)
  <span class="ruby-identifier">message</span> = <span class="ruby-identifier">prepare_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">color</span>)
  <span class="ruby-identifier">result</span> = <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">Thor</span><span class="ruby-operator">::</span><span class="ruby-constant">LineEditor</span>.<span class="ruby-identifier">readline</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">options</span>)

  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">result</span>

  <span class="ruby-identifier">result</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">strip</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">default</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">result</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span>
    <span class="ruby-identifier">default</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">result</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-can_display_colors-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">can_display_colors?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="can_display_colors-3F-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 360</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">can_display_colors?</span>
  <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-dynamic_width" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">dynamic_width</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Calculate the dynamic width of the terminal</p>

                              <div class="method-source-code" id="dynamic_width-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 415</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">dynamic_width</span>
  <span class="ruby-ivar">@dynamic_width</span> <span class="ruby-operator">||=</span> (<span class="ruby-identifier">dynamic_width_stty</span>.<span class="ruby-identifier">nonzero?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">dynamic_width_tput</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-dynamic_width_stty" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">dynamic_width_stty</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="dynamic_width_stty-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 419</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">dynamic_width_stty</span>
  <span class="ruby-string">`stty size 2&gt;/dev/null`</span>.<span class="ruby-identifier">split</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_i</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-dynamic_width_tput" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">dynamic_width_tput</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="dynamic_width_tput-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 423</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">dynamic_width_tput</span>
  <span class="ruby-string">`tput cols 2&gt;/dev/null`</span>.<span class="ruby-identifier">to_i</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-lookup_color" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">lookup_color</span><span
                                class="method-args">(color)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="lookup_color-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 364</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">lookup_color</span>(<span class="ruby-identifier">color</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">color</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">color</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-prepare_message" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">prepare_message</span><span
                                class="method-args">(message, *color)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="prepare_message-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 355</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">prepare_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">color</span>)
  <span class="ruby-identifier">spaces</span> = <span class="ruby-string">&quot;  &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">padding</span>
  <span class="ruby-identifier">spaces</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">set_color</span>(<span class="ruby-identifier">message</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">color</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-stderr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">stderr</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="stderr-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 373</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">stderr</span>
  <span class="ruby-identifier">$stderr</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-stdout" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">stdout</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="stdout-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 369</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">stdout</span>
  <span class="ruby-identifier">$stdout</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-truncate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">truncate</span><span
                                class="method-args">(string, width)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="truncate-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 431</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">truncate</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">width</span>)
  <span class="ruby-identifier">as_unicode</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">chars</span> = <span class="ruby-identifier">string</span>.<span class="ruby-identifier">chars</span>.<span class="ruby-identifier">to_a</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">chars</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">width</span>
      <span class="ruby-identifier">chars</span>.<span class="ruby-identifier">join</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">chars</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">width</span> <span class="ruby-operator">-</span> <span class="ruby-value">3</span>].<span class="ruby-identifier">join</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;...&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-unix-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">unix?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="unix-3F-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/basic.rb, line 427</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unix?</span>
  <span class="ruby-constant">RUBY_PLATFORM</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris)/i</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

